package com.huanshi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Collection;

/**
 * <p>
 * 用户信息表
 * </p>
 *
 * @author 幻世
 * @since 2023-09-13
 */
@Data
@Builder
@TableName("ums_admin")
@ApiModel(value = "User对象", description = "用户信息表")
public class UmsAdmin implements Serializable, UserDetails {

    private static final long serialVersionUID = 1L;

      @ApiModelProperty("用户ID")
      @TableId(value = "user_id", type = IdType.AUTO)
      private Long userId;

      @ApiModelProperty("用户账号")
      private String userName;

      @ApiModelProperty("用户昵称")
      private String nickName;

      @ApiModelProperty("用户邮箱")
      private String email;

      @ApiModelProperty("手机号码")
      private String phonenumber;

      @ApiModelProperty("用户性别（0男 1女 2未知）")
      private String sex;

      @ApiModelProperty("头像地址")
      private String avatar;

      @ApiModelProperty("密码")
      private String password;

      @ApiModelProperty("帐号状态（0正常 1停用）")
      private String status;

      @ApiModelProperty("删除标志（0代表存在 2代表删除）")
      private String delFlag;
      @ApiModelProperty("创建时间")
      private LocalDateTime createTime;

      @ApiModelProperty("更新时间")
      private LocalDateTime updateTime;

      @ApiModelProperty("备注")
      private String remark;


  @Override
  public Collection<? extends GrantedAuthority> getAuthorities() {
    return null;
  }

  @Override
  public String getUsername() {
    return String.valueOf(userId);
  }

  public String getUserName() {
    return userName;
  }

  @Override
  public boolean isAccountNonExpired() {
    return false;
  }

  @Override
  public boolean isAccountNonLocked() {
    return false;
  }

  @Override
  public boolean isCredentialsNonExpired() {
    return false;
  }

  @Override
  public boolean isEnabled() {
    return false;
  }
}
